package com.androidwwf.jwr;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
 
public class GameRandomPictureImageAdapter extends BaseAdapter {
	private Context context;
	private final String[] mobileValues;
 
	public GameRandomPictureImageAdapter(Context context, String[] mobileValues) {
		this.context = context;
		this.mobileValues = mobileValues;
	}
 
	public View getView(int position, View convertView, ViewGroup parent) {
 
		LayoutInflater inflater = (LayoutInflater) context
			.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 
		View gridView;
 
		if (convertView == null) {
 
			gridView = new View(context);
 
			// get layout from mobile.xml
			gridView = inflater.inflate(R.layout.gamesinglepicture, null);

 
			// set image based on selected text
			ImageView imageView = (ImageView) gridView
					.findViewById(R.id.grid_item_image);
 
			String mobile = mobileValues[position];
 
			if (mobile.equals("test1")) {
				imageView.setImageResource(R.drawable.test1);
			} else if (mobile.equals("test2")) {
				imageView.setImageResource(R.drawable.test2);
			} else if (mobile.equals("test3")) {
				imageView.setImageResource(R.drawable.test3);
			} else if (mobile.equals("test4")) {
				imageView.setImageResource(R.drawable.test4);
			} else if (mobile.equals("test5")) {
				imageView.setImageResource(R.drawable.test5);
			} else if (mobile.equals("test6")) {
				imageView.setImageResource(R.drawable.test6);
			} else if (mobile.equals("test7")) {
				imageView.setImageResource(R.drawable.test7);
			} else if (mobile.equals("test8")) {
				imageView.setImageResource(R.drawable.test8);
			} else if (mobile.equals("test9")) {
				imageView.setImageResource(R.drawable.test9);
			} else if (mobile.equals("test10")) {
				imageView.setImageResource(R.drawable.test10);
			} else if (mobile.equals("test11")) {
				imageView.setImageResource(R.drawable.test11);
			} else if (mobile.equals("test12")) {
				imageView.setImageResource(R.drawable.test12);
			} else if (mobile.equals("test13")) {
				imageView.setImageResource(R.drawable.test13);
			} else if (mobile.equals("test14")) {
				imageView.setImageResource(R.drawable.test14);
			} else if (mobile.equals("test15")) {
				imageView.setImageResource(R.drawable.test15);
			} else if (mobile.equals("test16")) {
				imageView.setImageResource(R.drawable.test16);
			} else if (mobile.equals("test17")) {
				imageView.setImageResource(R.drawable.test17);
			} else if (mobile.equals("test18")) {
				imageView.setImageResource(R.drawable.test18);
			} else if (mobile.equals("test19")) {
				imageView.setImageResource(R.drawable.test19);
			} else if (mobile.equals("test20")) {
				imageView.setImageResource(R.drawable.test20);
			}
			
 
		} else {
			gridView = (View) convertView;
		}
 
		return gridView;
	}

	public int getCount() {
		// TODO Auto-generated method stub
		return mobileValues.length;
	}

	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}
 

 
}
